package org.hentor.modules.generate.generate.enums;

/**
 * 平台类型与mysql类型对应
 */
public enum GenerateMysqlType {

    /**
     * 字符类型
     */
    stringType("string","varchar"),

    /**
     * 正数类型
     */
    intType("int","int"),

    /**
     * 浮点型
     */
    doubleType("double","double"),

    /**
     * 大数据引用类型
     */
    BigDecimalType("BigDecimal","BigDecimal"),

    /**
     * 文本类型
     */
    textType("text","text"),

    /**
     * 日期类型
     */
    dateType("date","datetime");



    private String code;
    private String desc;

    GenerateMysqlType(String code, String desc){
        this.code = code;
        this.desc = desc;
    }

    public static String getDescByCode(String code) {
        for (GenerateMysqlType myEnum : GenerateMysqlType.values()) {
            if (myEnum.getCode().equals(code)) {
                return myEnum.getDesc();
            }
        }
        return "";
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}
